$(function () {
    findNews();

});

function findNews() {
    $.ajax({
        url: '/news/findAllNews',
        data:{type: 1},
        type: 'get',
        dataType: 'json',
        success: function (data) {
            // console.log(data.data.NewsModel,"00000000");
            setNewsData(data.data.NewsModel);
        }
    })
}

function setNewsData(data) {
    let footHtml = '';
    footHtml+='<div>\n' +
        '                    <div onclick="change('+data[0].id+')">'+data[0].name+'</div>\n' +
        '                    <div onclick="change('+data[1].id+')">'+data[1].name+'</div>\n' +
        '                    <div onclick="change('+data[2].id+')">'+data[2].name+'</div>\n' +
        '                </div>\n' +
        '                <div>\n' +
        '                    <div>'+data[0].createTime+'</div>\n' +
        '                    <div>'+data[1].createTime+'</div>\n' +
        '                    <div>'+data[2].createTime+'</div>\n' +
        '                </div>';
    $("#footHtml").html(footHtml);
    // console.log($("#news").html())
}
function change(id){
    sessionStorage.setItem("id",id);
    location.href = '/front/html/newPage.html';
}